#include <iostream>
#include <vector>
using namespace std;
vector<int> arr;
vector<vector<int>> ret;
vector<int> path;
vector<int> vis;
int n, m;
void dfs(int pos, int sum) {
    if (sum == m) {
        ret.push_back(path);
        return ;
    }
    if (sum > m) {
        return;
    }
    for (int i = pos; i < n; i++) {
        if (!vis[i]) {
            vis[i] = 1;
            path.push_back(arr[i]);
            dfs(i + 1, sum + arr[i]);
            vis[i] = 0;
            path.pop_back();
        }
    }
}
int main() {

    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        arr.push_back(i);
    vis.resize(n + 1);
    dfs(0, 0);
    for (int i = 0; i < ret.size(); i++) {
        for (int j = 0; j < ret[i].size(); j++) {
            cout << ret[i][j] << ' ';
        }
        cout << endl;
    }
    return 0;
}
